import { CLOSE_MENU, OPEN_MENU, UPDATE_NAME } from '../action/type'

const initialState = {
  action: '',
  name: ''
}

const reducer = (state = initialState, action) => {
  switch (action.type) {
    case CLOSE_MENU:
      // return Object.assign({}, state, { action: 'closeMenu' })
      return { ...state, action: 'closeMenu' }
    case OPEN_MENU:
      return Object.assign({}, state, { action: 'openMenu' })
    case UPDATE_NAME:
      return Object.assign({}, state, { name: action.name })
    default:
      return state
  }
}

export default reducer
